from flask import Blueprint, jsonify, request  # 导入Flask相关模块
from applications.models import Comment, ArtComment, db  # 导入评论模型及数据库实例

# 创建评论管理蓝图
comment_bp = Blueprint('comment_bp', __name__, url_prefix='/system/comment')

# 获取所有花品评论
@comment_bp.route('/flowers', methods=['GET'])
def get_flower_comments():
    comments = Comment.query.all()  # 查询所有花品评论
    return jsonify([{'id': comment.id, 'content': comment.content} for comment in comments]), 200  # 返回评论信息

# 获取所有故事文章评论
@comment_bp.route('/articles', methods=['GET'])
def get_article_comments():
    comments = ArtComment.query.all()  # 查询所有故事文章评论
    return jsonify([{'id': comment.id, 'content': comment.content} for comment in comments]), 200  # 返回评论信息

# 注册评论管理蓝图
def register_comment_bps(app):
    app.register_blueprint(comment_bp) 